**************************************************************
** Replication Code for 
** Article "Hello, Goodbye: When do States Withdraw from International Organizations?"
** Inken von Borzyskowski and Felicity Vabulas
** Review of International Organizations 2019  
**
** Last Updated: March 2019
**************************************************************

// OS X Mojave
// Software: Stata 14.2 SE
// Set working directory to the location of RIO_replication data.dta and load data
cd ""
use "RIO_replication data.dta", clear



// Install if you haven't yet
ssc install estout
ssc install sutex
ssc install grstyle
ssc install egenmore
ssc install listtab
net install gr0002_3, from (http://www.stata-journal.com/software/sj4-3)   
ssc install cem 
ssc install coefplot

* install relogit.ado: 
* 	follow instructions posted at https://gking.harvard.edu/scholar_software/relogit-rare-events-logistic-regression/1-1-stata
* 	step 1: download folder/package from https://gking.harvard.edu/relogit
* 	step 2: place in correct directory as described in King's readme file: 
* 		To install RELOGIT, launch Stata and then type
*		sysdir
* 		at the command prompt.             
*    If RELOGIT is strictly for your own use, copy all files to the PLUS
*    directory listed on your screen.  For example, the directory is
*    c:\ado\plus under Windows and ~/ado/plus/ under UNIX.  
* 	 If, on the other hand, you are a site administrator who wants to share RELOGIT with
*    other users on your network, copy all files to the SITE directory.  In
*    some cases the PLUS and SITE directories may not yet exist on your
*    computer.  For those cases, please use your operating system to create
*    the directory  that will hold the files.

* install relogitll.ado 
* 	This is to get model fit statistics (AIC, BIC, LL)
* 	http://travisbraidwood.altervista.org/dataverse.html
* 	follow instructions posted at http://travisbraidwood.altervista.org/Relogitll_Instructions_&_Example.do
* 	download / copy code from http://travisbraidwood.altervista.org/relogitll.ado
* 	put relogitll.ado in the folder "Stata/ado/base/r/"

* download latex at https://www.latex-project.org/get/ to open table output files





***************************************
* MANUSCRIPT
***************************************	


// Figure 1A
use "RIO_replication data.dta", clear
bysort IGO_num year: egen WDsumperIOyear=sum(Withdrawal)
collapse (max) Withdrawal WDsumperIOyear cowcode, by(IGO_num year) 	
by IGO_num year, sort: gen nvals = _n == 1 
set more off
by year, sort: count if nvals
by year, sort: egen totalIGOs= total(nvals)
bysort year: egen WDsumperyear=sum(WDsumperIOyear)
collapse (max) totalIGOs WDsumperyear , by(year)
twoway line  WDsumperyear  year, yscale(range(0(1)10)  alt axis(1)) ylabel(0(1)10) lpattern(solid dash) lcolor (black)   ///
	ytitle("Number of IGO Withdrawals",  axis(1))  ///
	|| line totalIGOs year, sort yaxis(2) yscale(alt axis(2)) ///
	lpattern(dot) lcolor (black black)   ///
	xtitle("Year") ytitle("Number of IGOs",  axis(2)) scheme(lean1) aspectratio(1.0) ///
	legend(order(1 "# IGO Withdrawals (right axis)" 2 "# of IGOs (left axis)" ) ///
	size(small) ring(0) position(12) bmargin(none) region(style(none)))  
graph export "Figure1A.pdf", replace



// Figure 1B
use "RIO_replication data.dta", clear
bysort year: egen WDsumperyear=sum(Withdrawal)
set more off
bysort year: sum WDsumperyear 
egen numIOsperYear = nvals(IGO_num), by(year) 
collapse (max) WDsumperyear numIOsperYear, by(year)
bysort year: gen WDperIOperYear=(WDsumperyear/numIOsperYear)*100
sort year 
twoway line  WDperIOperYear  year, lcolor (black)   ///
	ytitle("Percent" ) xtitle("Year") scheme(lean1) aspectratio(1.0) ///
	legend(off ) yscale(range(0 12)) yla(0(5)10)
graph export "Figure1B.pdf", replace



// Figure 2
use "RIO_replication data.dta", clear
gen obs=1
replace Withdrawal=0 if Withdrawal==.
by COUNTRY_NAME, sort: egen SumWithdrawal=total(Withdrawal)
collapse (max) SumWithdrawal, by(COUNTRY_NAME)
gsort -SumWithdrawal COUNTRY_NAME
drop if SumWithdrawal==0
gsort -SumWithdrawal
drop if SumWithdrawal<2

set scheme lean1
grstyle init
grstyle color background white
grstyle color major_grid white

graph hbar SumWithdrawal,  ///
	blabel(bar, position(base) format(%9.0f) color(black)) ///
	over(COUNTRY_NAME, sort(1) descending  gap(*0.7) lab(labsize(vsmall ))) ytitle("Frequency",size(vsmall))  ///
	graphregion(color(white)) ylabel(,labsize(vsmall)) ysize(4.8) xsize(3) 
graph export "Figure2.pdf", replace
grstyle clear



// Figure 3
use "RIO_replication data.dta", clear
gen obs=1
replace Withdrawal=0 if Withdrawal==.
by IGO_short, sort: egen SumWithdrawal=total(Withdrawal)
collapse (max) SumWithdrawal, by(IGO_long)
gsort -SumWithdrawal IGO_long
drop if SumWithdrawal==0
gsort -SumWithdrawal
drop if SumWithdrawal<3

set scheme lean1
grstyle init
grstyle color background white
grstyle color major_grid white

graph hbar SumWithdrawal, ///
	blabel(bar, position(base) format(%9.0f) color(black)) ///
	over(IGO_long, sort(1) descending  gap(*0.7) lab(labsize(vsmall ))) ytitle("Frequency",size(vsmall))  ///
	graphregion(color(white)) ylabel(,labsize(vsmall)) ysize(4.8) xsize(3) 
graph export "Figure3.pdf", replace
grstyle clear



// Figure 4  
use "RIO_replication data.dta", clear
keep if Withdrawal==1
tab GeneralReason, mi

set scheme lean1
grstyle init
grstyle color background white
grstyle color major_grid white

catplot GeneralReason, percent var1opts(sort(1) descending) ///
	  ytitle("Percent")  l1title("")  
graph export "Figure4.pdf", replace

grstyle clear



// Figure 5
use "RIO_replication data.dta", clear
set more off	
local PolDom		Democracy_Lag1   GovmtOrientChange     
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log  time time2 time3
eststo: relogitll  Withdrawal NationalistExec `PolDom'   	`controls' if year>=1990 , cluster(IGO_num)
est store Fig5m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal NationalistExecVote `PolDom'   `controls' if year>=1990, cluster(IGO_num)
est store Fig5m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal NationalistGov `PolDom'   	`controls' if year>=1990 , cluster(IGO_num)
est store Fig5m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal NationalistGovVote `PolDom'   `controls'  if year>=1990 , cluster(IGO_num)
est store Fig5m4
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal NationalistOpp `PolDom'   	`controls' if year>=1990 , cluster(IGO_num)
est store Fig5m5
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal NationalistOppVote `PolDom'  	`controls' if year>=1990 , cluster(IGO_num)
est store Fig5m6
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal Populist `PolDom'   			`controls' if year>=1990 , cluster(IGO_num)
est store Fig5m7
scalar list 
estadd scalar AIC
estadd scalar BIC

set scheme lean1
grstyle init
grstyle color background white
grstyle color major_grid white

coefplot (Fig5m1) (Fig5m2) (Fig5m3) (Fig5m4) (Fig5m5) (Fig5m6) (Fig5m7) ///
	, drop( _cons time*  ///
	Institutionalization_Lag1 WithdrawalClause  ///
	IOissuePolitics IOissueEcon ///
	Democracy_Lag1 BS_Lag1 GovmtOrientChange  ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePower_Lag1 StatePowerChange   ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log ) xline(0, lpattern(dash)) ///
	legend(off) msymbol(d) nooffsets mcolor(blue) ciopts(color (blue))
graph export "Figure5.pdf", replace
grstyle clear




// Table 1
use "RIO_replication data.dta", clear
set more off	
local PolDom		Democracy_Lag1  GovmtOrientChange Nationalist_Lag1   
local Function 		Institutionalization_Lag1 IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolIntl		StatePowerChange PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log time time2 time3   

relogitll  Withdrawal  `PolDom'  					`controls' , cluster(IGO_num)
est store T1m1
scalar list 
estadd scalar AIC
estadd scalar BIC

relogitll  Withdrawal  `Function'  					`controls' , cluster(IGO_num)
est store T1m2
scalar list 
estadd scalar AIC
estadd scalar BIC

relogitll  Withdrawal  `PolIntl'  					 `controls' , cluster(IGO_num)
est store T1m3
scalar list 
estadd scalar AIC
estadd scalar BIC

relogitll  Withdrawal `PolDom'  `Function'  `PolIntl' `controls' , cluster(IGO_num)
est store T1m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table 1 output
esttab T1m* using Table1.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  ///
	noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1  GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1 IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log) ///
	drop ( _cons time*  )
	
	


// CEM results mentioned in results section  
use "RIO_replication data.dta", clear
set more off	
foreach varname in  Withdrawal Democracy_Lag1 GovmtOrientChange Nationalist_Lag1   ///
	time time2 time3  GDPGrowth_Lag1 {
	drop if `varname'==.
	}	

cem Democracy_Lag1 (#5) GovmtOrientChange (#1) GDPGrowth_Lag1(#5), tr(Nationalist_Lag1)

relogitll Withdrawal Nationalist_Lag1 [iweight=cem_weights]

relogitll Withdrawal Nationalist_Lag1 ///
	Democracy_Lag1 GovmtOrientChange GDPGrowth_Lag1 [iweight=cem_weights]
	
relogitll Withdrawal Nationalist_Lag1 ///
	Democracy_Lag1 GovmtOrientChange GDPGrowth_Lag1 ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log time time2 time3 ///
	[iweight=cem_weights] 
	
	
	
	
	
	
	
	

	
***************************************
* ONLINE APPENDIX  
***************************************	

// Appendix Table A1 
use "RIO_replication data.dta", clear
set more off
sutex Withdrawal ///
		Institutionalization_Lag1 IOperformance WithdrawalClause  IOavgDemScore ///
		IOissuePolitics  IOissueSecurity IOissueEcon  ///
		Democracy_Lag1 BS_Lag1 GovmtOrientChange Nationalist_Lag1 ///
		PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
		WithdrawalFoundingState_Lag1 WithdrawalRegPower_Lag1 ///
		StatePower_Lag1  StatePowerChange ///
		IOsize_Lag1Log IOMembershipDuration_Lag1Log  ///
		NationalistExec NationalistExecVote ///
		NationalistGov NationalistGovVote ///
		NationalistOpp NationalistOppVote Populist ///
		ColdWar  GDPGrowth_Lag1 UnemploymentChange ///
		UNspecializedAgency, file(TableA1.tex) replace minmax label digits(4)


	
// Appendix Table A2
use "RIO_replication data.dta", clear
drop if IOperformance==.
set more off	
local Function 		IOperformance  IOavgDemScore 
local PolDom		Democracy_Lag1  GovmtOrientChange Nationalist_Lag1   
local PolIntl		StatePowerChange PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log time time2 time3
eststo: relogitll  Withdrawal  `Function'    				`controls'   ,  cluster(IGO_num)
est store TA2m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal Institutionalization_Lag1  `Function'  	  				`controls'  , cluster(IGO_num)
est store TA2m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function' `PolDom' PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1     `controls'   , cluster(IGO_num)
est store TA2m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal Institutionalization_Lag1  `Function' `PolDom' PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1  `controls'   , cluster(IGO_num)
est store TA2m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A2 output
esttab TA2m* using TableA2.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(IOperformance Institutionalization_Lag1 IOavgDemScore  ///
	Democracy_Lag1 GovmtOrientChange Nationalist_Lag1 ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log    ) ///
	drop ( _cons time*  )



// Appendix Table A3 
use "RIO_replication data.dta", clear
set more off	
local Function 		Institutionalization_Lag1  IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolDom		Democracy_Lag1 GovmtOrientChange Nationalist_Lag1   
local PolIntl		StatePowerChange PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log GDPGrowth_Lag1 UnemploymentChange ///
					time time2 time3
eststo: relogitll  Withdrawal  `PolDom'  					`controls' , cluster(IGO_num)
est store TA3m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function'  					`controls' , cluster(IGO_num)
est store TA3m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `PolIntl'  					 `controls' , cluster(IGO_num)
est store TA3m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function' `PolDom' `PolIntl' `controls' , cluster(IGO_num)
est store TA3m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A3 output
esttab TA3m* using TableA3.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1  GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1  IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log  GDPGrowth_Lag1 UnemploymentChange) ///
	drop ( _cons time*  )

	
	
// Appendix Table A4 
use "RIO_replication data.dta", clear
set more off	
local Function 		Institutionalization_Lag1 IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolDom		Democracy_Lag1 GovmtOrientChange Nationalist_Lag1   
local PolIntl		StatePowerChange PrefDiversionFromIOavg_Lag1 
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log  time time2 time3
eststo: relogitll  Withdrawal WithdrawalFoundingState_Lag1  `PolIntl'  					 `controls' , cluster(IGO_num)
est store TA4m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal WithdrawalFoundingState_Lag1 `Function' `PolDom' `PolIntl' `controls' , cluster(IGO_num)
est store TA4m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal WithdrawalRegPower_Lag1  `PolIntl'  					 `controls' , cluster(IGO_num)
est store TA4m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal WithdrawalRegPower_Lag1 `Function' `PolDom' `PolIntl' `controls' , cluster(IGO_num)
est store TA4m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A4 output
esttab TA4m* using TableA4.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1  GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1  IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 ///
	WithdrawalFoundingState_Lag1 WithdrawalRegPower_Lag1  ///
	StatePowerChange  ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log) ///
	drop ( _cons time*  )

	
	
// Appendix Table A5 
use "RIO_replication data.dta", clear
gen fix=1 if Withdrawal!=.& Institutionalization_Lag1!=.& IOavgDemScore!=.&  ///
		IOissuePolitics!=.&  IOissueEcon!=.&   ///
		Democracy_Lag1!=.&GovmtOrientChange!=.& Nationalist_Lag1!=.& ///
		 StatePowerChange!=.&  PrefDiversionFromIOavg_Lag1!=.& ///
		WithdrawalLeadState_Lag1!=.& ///
		 IOMembershipDuration_Lag1Log!=.& IOsize_Lag1Log!=.&  ///
		 time!=.& time2!=.& time3!=.
set more off	
local Function 		Institutionalization_Lag1  IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolDom		Democracy_Lag1  GovmtOrientChange Nationalist_Lag1   
local PolIntl		StatePowerChange  PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log    time time2 time3
eststo: relogitll  Withdrawal  `PolDom'  					`controls'  if fix==1 , cluster(IGO_num)
est store TA5m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function'  					`controls' if fix==1 , cluster(IGO_num)
est store TA5m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `PolIntl'  					 `controls'  if fix==1 , cluster(IGO_num)
est store TA5m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function' `PolDom' `PolIntl' `controls'  if fix==1 , cluster(IGO_num)
est store TA5m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A5 output
esttab TA5m* using TableA5.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1 GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1  IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange  ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log) ///
	drop ( _cons time*  )

	
	
// Appendix Table A6 
use "RIO_replication data.dta", clear
set more off	
local Function 		Institutionalization_Lag1 IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolDom		Democracy_Lag1  GovmtOrientChange Nationalist_Lag1   
local PolIntl		StatePowerChange PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log time time2 time3
eststo: relogitll  Withdrawal  `PolDom' 	`controls' if ColdWar==1 , cluster(IGO_num)
est store TA6m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function'  	`controls' if ColdWar==1 , cluster(IGO_num)
est store TA6m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `PolIntl'  	`controls' if ColdWar==1 , cluster(IGO_num)
est store TA6m3
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A6 output
esttab TA6m* using TableA6.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1 GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1 IOavgDemScore ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log) ///
	drop ( _cons time*  )
	
	
	
// Appendix Table A7 
use "RIO_replication data.dta", clear	
set more off
local Function 		Institutionalization_Lag1     IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolDom		Democracy_Lag1  GovmtOrientChange Nationalist_Lag1   
local PolIntl		StatePowerChange PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log    time time2 time3
eststo: relogitll  Withdrawal  `PolDom'  					`controls'  if ColdWar==0 , cluster(IGO_num)
est store TA7m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function'  					`controls' if ColdWar==0 , cluster(IGO_num)
est store TA7m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `PolIntl'  					 `controls'  if ColdWar==0 , cluster(IGO_num)
est store TA7m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function' `PolDom' `PolIntl' `controls'  if ColdWar==0 , cluster(IGO_num)
est store TA7m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A7 output
esttab TA7m* using TableA7.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1 GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1 IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log) ///
	drop ( _cons time*  )


	
// Appendix Table A8
use "RIO_replication data.dta", clear
set more off
local Function 		IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolDom		Democracy_Lag1 Nationalist_Lag1   
local PolIntl		StatePowerChange PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log time time2 time3
eststo: relogitll  Withdrawal  `PolDom'  					`controls' , cluster(IGO_num)
est store TA8m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function'  					`controls' , cluster(IGO_num)
est store TA8m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `PolIntl'  					 `controls' , cluster(IGO_num)
est store TA8m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function' `PolDom' `PolIntl' `controls' , cluster(IGO_num)
est store TA8m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A8 output
esttab TA8m* using TableA8.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order( Democracy_Lag1     Nationalist_Lag1 ///
	IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log) ///
	drop ( _cons time*  )

	
	
// Appendix Table A9 
use "RIO_replication data.dta", clear
set more off	
local Function 		Institutionalization_Lag1     IOavgDemScore  ///
		IOissuePolitics IOissueEcon
local PolDom		Democracy_Lag1   GovmtOrientChange Nationalist_Lag1   
local PolIntl		   StatePowerChange  PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log    time time2 time3 UNspecializedAgency
eststo: relogitll  Withdrawal  `PolDom'  					`controls' , cluster(IGO_num)
est store TA9m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function'  					`controls' , cluster(IGO_num)
est store TA9m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `PolIntl'  					 `controls' , cluster(IGO_num)
est store TA9m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function' `PolDom' `PolIntl' `controls' , cluster(IGO_num)
est store TA9m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A9 output
esttab TA9m* using TableA9.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1   GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1  IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log  ///
	UNspecializedAgency) ///
	drop ( _cons time*  )

	
	
// Appendix Table A10
use "RIO_replication data.dta", clear
set more off	
local PolDom		Democracy_Lag1  GovmtOrientChange Nationalist_Lag1   
local Function 		Institutionalization_Lag1    IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolIntl		StatePowerChange  PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log       time time2 time3   
eststo: relogitll  Withdrawal  `PolDom' BS_Lag1 					`controls' , cluster(IGO_num)
est store TA10m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function'  		WithdrawalClause			`controls' , cluster(IGO_num)
est store TA10m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `PolIntl'  	StatePower_Lag1				 `controls' , cluster(IGO_num)
est store TA10m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal `PolDom'  `Function'  `PolIntl' `controls'  BS_Lag1 WithdrawalClause StatePower_Lag1 , cluster(IGO_num)
est store TA10m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A10 output
esttab TA10m* using TableA10.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1  GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1  IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange  ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log ///
	BS_Lag1 WithdrawalClause StatePower_Lag1) ///
	drop ( _cons time*  )
	
	
	
// Appendix Table A11
use "RIO_replication data.dta", clear
set more off	
local Function 		Institutionalization_Lag1     IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolDom		Democracy_Lag1   GovmtOrientChange Nationalist_Lag1   
local PolIntl		StatePowerChange  PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log    time time2 time3
logit  Withdrawal  `PolDom'  					`controls'  , cluster(IGO_num)
est store TA11m1
logit  Withdrawal  `Function'  					`controls'  , cluster(IGO_num)
est store TA11m2
logit  Withdrawal  `PolIntl'  					 `controls'  , cluster(IGO_num)
est store TA11m3
logit Withdrawal  `Function' `PolDom' `PolIntl' `controls'  , cluster(IGO_num)
est store TA11m4
// Table A11 output
esttab TA11m* using TableA11.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01)   noconstant label alignment(D{.}{.}{-1}) ///
	stats(N aic bic, fmt(0  2 2) label("Observations"  "AIC" "BIC" )) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1   GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1  IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange  ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log) ///
	drop ( _cons time*  )

	
	
// Appendix Table A12
use "RIO_replication data.dta", clear
set more off	
local PolDom		Democracy_Lag1  GovmtOrientChange Nationalist_Lag1   
local Function 		Institutionalization_Lag1 IOavgDemScore  ///
					IOissuePolitics IOissueEcon
local PolIntl		StatePowerChange PrefDiversionFromIOavg_Lag1 ///
					WithdrawalLeadState_Lag1
local controls		IOMembershipDuration_Lag1Log IOsize_Lag1Log time time2 time3   
eststo: relogitll  Withdrawal  `PolDom'  					`controls' , cluster(cowcode)
est store TA12m1
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `Function'  					`controls' , cluster(cowcode)
est store TA12m2
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal  `PolIntl'  					 `controls' , cluster(cowcode)
est store TA12m3
scalar list 
estadd scalar AIC
estadd scalar BIC
eststo: relogitll  Withdrawal `PolDom'  `Function'  `PolIntl' `controls' , cluster(cowcode)
est store TA12m4
scalar list 
estadd scalar AIC
estadd scalar BIC
// Table A12 output
esttab TA12m* using TableA12.tex, replace b(3) se(3) staraux ///
	star(* 0.10 ** 0.05 *** 0.01) scalar(AIC BIC)  noconstant label alignment(D{.}{.}{-1}) ///
	title(Determinants of IGO Withdrawals\label{results})  ///
	order(Democracy_Lag1  GovmtOrientChange Nationalist_Lag1 ///
	Institutionalization_Lag1 IOavgDemScore  ///
	IOissuePolitics IOissueEcon ///
	PrefDiversionFromIOavg_Lag1 WithdrawalLeadState_Lag1 ///
	StatePowerChange  ///
	IOMembershipDuration_Lag1Log IOsize_Lag1Log) ///
	drop ( _cons time*  )
	
	


 
